package org.feng.manage.animal;

import org.feng.api.animal.request.AddAndUpdateAnimalRequest;
import org.feng.api.animal.response.AddAndUpdateAnimalDto;
import org.feng.manage.sys.AbstractOperateHandlerTemplate;
import org.feng.manage.sys.CLog;
import org.feng.manage.sys.OperateContext;
import org.feng.service.IAnimalService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


/**
 * 新增动物管理器
 *
 * @author feng
 */
@Component
public class AnimalAddManage extends AbstractOperateHandlerTemplate<AddAndUpdateAnimalRequest, AddAndUpdateAnimalDto> {

    @Resource
    private IAnimalService animalService;

    @Override
    @CLog(template = "32423423daedas")
    public AddAndUpdateAnimalDto handle(OperateContext<AddAndUpdateAnimalRequest> context) {
        AddAndUpdateAnimalRequest data = context.getData();
        return animalService.saveOrUpdate(data);
    }
}
